<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // ...展开数组
      var a = [1, 2, 3]
      var b = [4, 5, 6]
      var c = [...a, ...b]
      console.log(c) //Array(6)

      // ...复制
      var x = [1, 2, 3]
      var y = [...x]
      console.log(y) // [1,2,3]
      console.log(x === y) //false

      // ...参数-实参-形参
      var test = (...arr) => {
        console.log(arr)
      }
      test(1, 2, 3, 4, 5) //[1,2,3,4,5]

      // ...伪数组转换
      function test1() {
        var arr = [...arguments]
        console.log(arr) //[1,2,3,4,5]
      }
      test1(1, 2, 3, 4, 5)

      // ...对象
      var a2 = { one: 1, two: 2, th: 3 }
      var b2 = { on: 1, tw: 2, the: 3 }
      var c2 = { ...a2, ...b2 }
      console.log(c2) //{one: 1, two: 2, th: 3, on: 1, tw: 2, …}
    </script>
  </body>
</html>
